package com.quasar.hpatient.view.adapter;

import android.text.Html;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.quasar.hpatient.R;
import com.quasar.hpatient.model.medicalmodel.CollectionListData;
import com.quasar.hpatient.network.RetrofitConnection;

/**
 * author : 许建宏
 * Date: 2017/10/11 0011
 * View:
 */

public class CollectionAdapter extends BaseQuickAdapter<CollectionListData, BaseViewHolder> {

    //绑定布局和绑定数据
    public CollectionAdapter() {
        super(R.layout.collection_item_layout);
    }

    //绑定控件
    @Override
    protected void convert(BaseViewHolder helper, CollectionListData item) {

        if (item.getMedicalInformations().getTitle() != null) {
            helper.setText(R.id.consult_tv_title,item.getMedicalInformations().getTitle());
        }

        //头像
        if (item.getMedicalInformations().getCover() != null && item.getMedicalInformations().getCover().length() > 0) {
            Glide.with(mContext).load(RetrofitConnection.PHOTOURL + item.getMedicalInformations().getCover()).into((ImageView) helper.getView(R.id.consult_iv_pic));
        }

        //浏览量
        helper.setText(R.id.consult_tv_checknum,item.getMedicalInformations().getHit()+"");
        //收藏量
        helper.setText(R.id.consult_tv_collectnum,item.getMedicalInformations().getCollectNum()+"");
//        //内容
//        if(item.getMedicalInformations().getContent()!=null && item.getMedicalInformations().getContent().length()>0){
//            helper.setText(R.id.tv_count,Html.fromHtml(item.getMedicalInformations().getContent()));
//        }
    }
}
